/*
 * @Author: your name
 * @Date: 2020-03-19 17:14:13
 * @LastEditTime: 2020-04-02 21:54:26
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue-imooc-ebook\src\store\modules\book.js
 */
const book = {
  state: {
    fileName: '', // 书籍名:分类/书名
    menuVisible: false, // 控制菜单标题栏的显示与否
    settingVisible: -1, // 默认给-1:不显示, 0:显示字号和字体设置,1:主题设置,2:进度条设置,3:目录设置
    defaultFontSize: 16, // 默认字号设置的大小
    defaultFontFamily: 'Default', // 默认字体
    fontFamilyVisible: false, // 字体设置组件显示
    defaultTheme: 'default', // 默认主题
    bookAvailable: false, // 进度中的,分页设置后就可以设置为true
    progress: 0, // 进度100内的整数,@onProgressChange方法获取
    section: 0, // 指定当前章节的位置.1表示第一章节2表示第二章节...整数型
    isPaginating: true,
    currentBook: null, // 当前的电子书book对象
    navigation: null, // 拍扁后加入level的目录
    cover: null,
    metadata: null, // 电子书的信息
    paginate: '', // 页脚
    pagelist: null, // locations列表，都是epubcfi
    offsetY: 0, // 用于书签，y轴的偏移量
    isBookmark: null // 表示当前页是否为书签页
  },
  mutations: {
    'SET_FILENAME': (state, fileName) => {
      state.fileName = fileName
    },
    'SET_MENU_VISIBLE': (state, visible) => {
      state.menuVisible = visible
    },
    'SET_SETTING_VISIBLE': (state, visible) => {
      state.settingVisible = visible
    },
    'SET_DEFAULT_FONT_SIZE': (state, fontSize) => {
      state.defaultFontSize = fontSize
    },
    'SET_DEFAULT_FONT_FAMILY': (state, font) => {
      state.defaultFontFamily = font
    },
    'SET_FONT_FAMILY_VISIBLE': (state, visible) => {
      state.fontFamilyVisible = visible
    },
    'SET_DEFAULT_THEME': (state, theme) => {
      state.defaultTheme = theme
    },
    'SET_BOOK_AVAILABLE': (state, bookAvailable) => {
      state.bookAvailable = bookAvailable
    },
    'SET_PROGRESS': (state, progress) => {
      state.progress = progress
    },
    'SET_SECTION': (state, section) => {
      state.section = section
    },
    'SET_IS_PAGINATING': (state, isPaginating) => {
      state.isPaginating = isPaginating
    },
    'SET_CURRENT_BOOK': (state, currentBook) => {
      state.currentBook = currentBook
    },
    'SET_NAVIGATION': (state, navigation) => {
      state.navigation = navigation
    },
    'SET_COVER': (state, cover) => {
      state.cover = cover
    },
    'SET_METADATA': (state, metadata) => {
      state.metadata = metadata
    },
    'SET_PAGINATE': (state, paginate) => {
      state.paginate = paginate
    },
    'SET_PAGELIST': (state, pagelist) => {
      state.pagelist = pagelist
    },
    'SET_OFFSETY': (state, offsetY) => {
      state.offsetY = offsetY
    },
    'SET_IS_BOOKMARK': (state, isBookmark) => {
      state.isBookmark = isBookmark
    }
 }
}

export default book// 作为模块输出出去
